<template>
  <div>
    <chart :options="treeData" ref="tree" theme="ovilia-green" auto-resize style='width:100%;height:600px' @click='dchange'></chart>
  </div>
</template>

<script>
  import getData from './tree'
  export default {
    data() {
      return {
        treeData: getData
      }
    },
    created() {

    },
    methods: {
      dchange(e) {
        if (e.data.action === '-') {
          e.data.action = '+'
          e.data.label.formatter = [
            '{a|}',
            '{b|' + e.name + '}',
            '{c|+}'
          ].join('\n')
          this.$refs.tree.resize()
        } else if (e.data.action === '+') {
          e.data.action = '-'
          e.data.label.formatter = [
            '{a|}',
            '{b|' + e.name + '}',
            '{c|-}'
          ].join('\n')
          this.$refs.tree.resize()
        }
      }
    }
  }
</script>

<style>

</style>
